<template>
  <simple-layout title="支付密码">
    <!-- 手机号验证码 -->
<!--    <div class="verify-box" v-show="currentBox === 1">
      <div class="mui-input-row">
              <input type="password" class="mui-input-clear mui-input-password" placeholder="请输入密码">
          </div>

      <div class="ab-button-row">
        <button type="button" class="ab-btn ab-btn-primary"  @click="submitVerify">提交</button>
      </div>
    </div> -->

    <!-- 设置6位支付密码 -->
    <div class="pwd-set-box" v-show="currentBox === 2">
      <h4>设置6位数字支付密码</h4>
      <div class="pwd-input-list">
       <div class="mui-input-row">
               <input type="password" v-model="password" class="mui-input-clear mui-input-password" placeholder="请输入密码">
           </div>
      </div>
      <div class="ab-button-row">
        <button type="button" class="ab-btn ab-btn-primary" @click="submitPayPwd">提交</button>
      </div>
    </div>

    <!-- 设置成功 -->
    <div class="success-box" v-show="currentBox === 3">
      <div>
        <!--<img src="../../assets/auth/resetpayok.png">-->
        <h4>支付密码设置成功</h4>

        <div class="ab-button-row">
          <button type="button" class="ab-btn ab-btn-primary" @click="">返回账户首页</button>
        </div>
      </div>
    </div>
  </simple-layout>



</template>


<script>
  import SimpleLayout from '../../components/SimpleLayout';
  import PayService from '../../service/pay';

  export default {
    name: "Login",
    components: {
      //someComponent
      SimpleLayout
    },
    props: {},
    data() {
      return {
        msg: "Hello Vue.js",
        userInfo: JSON.parse(this.$cookie.get('user')),
        currentBox:2,
        phone: '',
        code: {},
        password: '',
        numCode: '发送验证码',
      }
    },
    computed: {},
    watch: {},
    mounted: function () {
      this.code = this.$route.query.product
    },
    methods: {
      // 页面切换
      submitVerify(){
        if(this.code){
          this.currentBox = 2;
        }else{
          mui.confirm('','请输入验证码',new Array('关闭'));
        }
      },
      submitPwd(){
        this.currentBox = 3;
      },

      // 点击提交
      submitPayPwd() {
        if(this.password.length < 6){
            mui.confirm('','请输入6位以上密码',new Array('关闭'),(e)=>{
            });
          }

        const params = {
          payPwd: this.password,
          id:  this.code.productId,
          payMode: 1,
          amount: this.code.depositAmount
        }
         console.log(this.params)
        PayService.paymentOrder(params).then((res) => {
          console.log(res)
          if (res.status == 200) {
            mui.confirm('','设置成功',new Array('关闭'),(e)=>{
              this.$router.push({ name:"UserInfo" });
            });
          }
          else {
            mui.confirm('',res.message,new Array('关闭'),(e)=>{

            });
          }
        })
      }
    }
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
 body{
    background: #F7F7F7!important;
  }
  .tips {
    height: 30px;
    line-height: 30px;
    background-color: #fff9f3;
    text-align: left;
    padding-left: 20px;
    font-size: 12px;
    color: #909091;
  }
  .mui-input-row {
    border-bottom: 1px solid #efeff4;
  }
  .mui-input-row label {
    width: 26%;
  }
  .mui-input-row input {
    float:left;
    width:100%;
    border: 0px;
  }
  .verrify-btn {
    float: left;
    padding: 11px 0;
    color: #7b7fee;
  }
  .ab-btn-primary {
    margin-top: 50px;
    width: 83%;
    height: 40px;
    color: white;
    background: rgb(130, 130, 244);
    border-radius: 15px;
    border: 0px;
  }
  .pwd-input-list {
    display: flex;
    justify-content: center;
    width: 85%;
    margin: 0 auto;
  }
  .pwd-input-list input {
    float: left;
    height: 50px;
    border-radius:0px;
    border-right: none;
    text-align: center;
  }
  .pwd-input-list input:last-child {
    border-right: 1px solid rgba(0, 0, 0, .2);
  }
 .pwd-set-box h4 {
   background: #F7F7F7;
   padding: 80px 0 35px;
  }
.pwd-set-box {
   height: 100vh;
   background: #F7F7F7;
}
.mui-input-row input {
  background: #F7F7F7;
}
  .success-box img {
    margin-top: 55px;
    margin-bottom: 10px;
  }
  .pwd-set-box /deep/ .mui-input-row span::before{
      content: '';
  }
</style>
